<template>
  <view class="progress-item">
    <view class="progress-header">
      <view class="progress-label">
        <text class="progress-icon">{{ icon }}</text>
        <text>{{ label }}</text>
      </view>
      <text :class="['progress-value', type]">{{ value }}%</text>
    </view>
    <view class="progress-bg">
      <view :class="['progress-bar', type]" :style="{ width: value + '%' }"></view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'ProgressBar',
  props: {
    label: {
      type: String,
      required: true
    },
    value: {
      type: [String, Number],
      required: true
    },
    icon: {
      type: String,
      default: '⭐'
    },
    type: {
      type: String,
      default: 'default',
      validator: (value) => {
        return ['default', 'emotion', 'pressure', 'energy', 'cognition'].includes(value);
      }
    }
  }
};
</script>

<style>
.progress-item {
  display: flex;
  flex-direction: column;
  gap: 8rpx;
  width: 100%;
  box-sizing: border-box;
}


.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 24rpx;
}

.progress-label {
  display: flex;
  align-items: center;
  gap: 10rpx;
}

.progress-icon {
  font-size: 28rpx;
}

.progress-bg {
  height: 10rpx;
  background-color: #374151;
  border-radius: 10rpx;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  height: 100%;
  border-radius: 10rpx;
  background: linear-gradient(to right, #6b7280, #9ca3af);
}

.progress-value.emotion {
  color: #ec4899;
}
.progress-bar.emotion {
  background: linear-gradient(to right, #be185d, #ec4899);
}

.progress-value.pressure {
  color: #f59e0b;
}
.progress-bar.pressure {
  background: linear-gradient(to right, #b45309, #f59e0b);
}

.progress-value.energy {
  color: #3b82f6;
}
.progress-bar.energy {
  background: linear-gradient(to right, #1d4ed8, #3b82f6);
}

.progress-value.cognition {
  color: #10b981;
}
.progress-bar.cognition {
  background: linear-gradient(to right, #047857, #10b981);
}
</style>